package fr.uniscol.service.impl;

import fr.uniscol.dao.IEtablissementDao;
import fr.uniscol.model.EtablissementModel;
import fr.uniscol.service.IEtablissementService;
import java.util.List;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("etablissementService")
public class EtablissementServiceImpl implements IEtablissementService {

	public static final Logger log = Logger.getLogger(EtablissementServiceImpl.class);
	
	@Autowired
	private IEtablissementDao etablissementDao;
	 
	@Override
	public EtablissementModel getEtablissementByUAI(String uai) {
		return etablissementDao.getEtablissementByUAI(uai);
	}

	@Override
	public EtablissementModel getEtablissementById(long id) {
		return etablissementDao.getEtablissementById(id);
	}

	@Override
	public boolean saveEtablissement(EtablissementModel etablissement) {
		long etabId = etablissementDao.saveEtablissement(etablissement);
        
        return etabId > 0;
	}

    @Override
    public List<EtablissementModel> getAllEtablissements() {
        return etablissementDao.getAllEtablissements();
    }

    @Override
    public boolean deleteEtablissement(EtablissementModel etablissement) {
        return etablissementDao.deleteEtablissement(etablissement);
    }
}
